package com.ccx.coachsite.ui.own;

import java.util.List;

import com.ccx.coachsite.bus.SoftInfo;
import com.ccx.coachsite.webimage.ImageLoader;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.ccx.coachsite.R;

public class OwerFriendDetailItemAdapter extends OwerAdapterBase<SoftInfo>{
	
	public OwerFriendDetailItemAdapter(Context context, List<SoftInfo> list) {
		super(context, list);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if(convertView == null) {
			convertView = mInflater.inflate(R.layout.ower_friend_grid_item, parent, false);
			holder = new ViewHolder();
			holder.mIcon = (ImageView) convertView.findViewById(R.id.index_grid_picture);
			holder.mDesc = (TextView) convertView.findViewById(R.id.index_grid_desc);
			
			convertView.setTag(holder);
		}else {
			holder = (ViewHolder) convertView.getTag();
		}
		
		String picturePath = mList.get(position).getIcon();
		if (picturePath != null) 
		{
			holder.mIcon.setImageResource(R.drawable.ower_image_none);
			ImageLoader.loadBitmap(picturePath, holder.mIcon);
		}
		
		holder.mDesc.setText(mList.get(position).getName());
		return convertView;
	}
	
	class ViewHolder {
		ImageView mIcon;
		TextView mDesc;
	}
}
